package t10086.Data.Robot;

import t10086.Data.Map.TextCoordinate;

import java.io.Serializable;
import java.net.InetSocketAddress;

public class RobotInfo implements Serializable {
    private String serialNumber;//序列号
    private int window;
    private TextCoordinate position;//当前位置
    private TextCoordinate next;//下一个希望去的位置
    private TextCoordinate termination;//本次的终点
    private RobotStatus robotStatus;//当前状态
    private InetSocketAddress listenedSocket;//机器人的等待接入ip
    private long selfMovingNumber;//移动序列号
    private long selfQueuingNumber;//排队序列号;
    public RobotInfo(String serialNumber,TextCoordinate position, TextCoordinate next,
                     TextCoordinate termination,RobotStatus robotStatus,
                     InetSocketAddress listenedSocket) {
        this.position = position;
        this.next = next;
        this.termination = termination;
        this.robotStatus = robotStatus;
        this.listenedSocket = listenedSocket;
        this.serialNumber = serialNumber;
        selfMovingNumber = 0;
        selfQueuingNumber = 0;
        this.window = 0;
    }
    public RobotInfo(){
        selfMovingNumber = 0;
        selfQueuingNumber = 0;
        this.position = new TextCoordinate(0,0);
        this.next = new TextCoordinate(0,0);
        this.termination = new TextCoordinate(0,0);
        this.robotStatus = RobotStatus.FREE;
        this.listenedSocket = null;
        this.window = 0;
    }

    public  void setAll(RobotInfo other){
        this.position = new TextCoordinate(other.getPosition());
        this.next = new TextCoordinate(other.getNext());
        if(other.getNext()==null){
            System.out.println(other.serialNumber);
        }
        this.termination = new TextCoordinate(other.getTermination());
        this.robotStatus = other.robotStatus;
        this.listenedSocket = other.listenedSocket;
        this.selfMovingNumber = other.selfMovingNumber;
        this.selfQueuingNumber = other.selfQueuingNumber;

    }
    public  TextCoordinate getPosition() {
        return position;
    }

    public  void  setPosition(TextCoordinate position) {
        this.position = position;
    }

    public  TextCoordinate getNext() {
        return next;
    }

    public  void setNext(TextCoordinate next) {
        this.next = next;
    }

    public  TextCoordinate getTermination() {
        return termination;
    }

    public  void setTermination(TextCoordinate termination) {
        this.termination = termination;
    }

    public  RobotStatus getRobotStatus() {
        return robotStatus;
    }

    public  void setRobotStatus(RobotStatus robotStatus) {
        this.robotStatus = robotStatus;
    }

    public  InetSocketAddress getListenedAddress() {
        return listenedSocket;
    }
    public  void setListenedAddress(InetSocketAddress listenedSocket) {
        this.listenedSocket = listenedSocket; }

    public  long getSelfQueuingNumber() {
        return selfQueuingNumber;
    }

    public  void setSelfQueuingNumber(long selfQueuingNumber) {
        this.selfQueuingNumber = selfQueuingNumber;
    }

    public  long getSelfMovingNumber() {
        return selfMovingNumber;
    }

    public  void setSelfMovingNumber(long selfMovingNumber) {
        this.selfMovingNumber = selfMovingNumber;
    }

    public  String getSerialNumber() {
        return serialNumber;
    }

    public  void setSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
    }

    public  int getWindow() {
        return window;
    }
    public  void setWindow(int window) {
        this.window = window;
    }
}
